﻿CREATE PROCEDURE [smk].[usp_Insert_ssas_trace_log]
           (@EventClass int  = NULL
           ,@ActivityID nvarchar(128) = NULL
           ,@ApplicationName nvarchar(128) = NULL
           ,@ClientHostName nvarchar(128) = NULL
           ,@ClientProcessID int = NULL
           ,@ConnectionID int = NULL
           ,@CurrentTime datetime = NULL
           ,@NTDomainName nvarchar(128) = NULL
           ,@NTUserName nvarchar(128) = NULL
           ,@RequestID nvarchar(128) = NULL
           ,@SPID int = NULL
           ,@ServerName nvarchar(128) = NULL
           ,@StartTime datetime = NULL
           ,@CPUTime bigint = NULL
           ,@DatabaseName nvarchar(128) = NULL
           ,@Duration bigint = NULL
           ,@NTCanonicalUserName nvarchar(128) = NULL
           ,@RequestProperties ntext = NULL
           ,@TextData ntext = NULL
           ,@Error int = NULL
           ,@EventSubclass int = NULL
           ,@SessionID nvarchar(128) = NULL
           ,@Severity int = NULL
           ,@Success int = NULL
           ,@EndTime datetime = NULL
           ,@ObjectID nvarchar(128) = NULL
           ,@ObjectName nvarchar(128) = NULL
           ,@ObjectPath nvarchar(128) = NULL
           ,@ObjectReference nvarchar(128) = NULL
           ,@ObjectType int = NULL
           ,@IntegerData bigint = NULL
           ,@ProgressTotal bigint = NULL
           ,@JobID int = NULL
           ,@SessionType nvarchar(128) = NULL
           ,@RequestParameters ntext = NULL
           ,@BinaryData image = NULL,
		   @ObjectTypeName nvarchar(max) )
AS
BEGIN
	INSERT INTO smk.ssas_trace_log
           ([EventClass]
           ,[ActivityID]
           ,[ApplicationName]
           ,[ClientHostName]
           ,[ClientProcessID]
           ,[ConnectionID]
           ,[CurrentTime]
           ,[NTDomainName]
           ,[NTUserName]
           ,[RequestID]
           ,[SPID]
           ,[ServerName]
           ,[StartTime]
           ,[CPUTime]
           ,[DatabaseName]
           ,[Duration]
           ,[NTCanonicalUserName]
           ,[RequestProperties]
           ,[TextData]
           ,[Error]
           ,[EventSubclass]
           ,[SessionID]
           ,[Severity]
           ,[Success]
           ,[EndTime]
           ,[ObjectID]
           ,[ObjectName]
           ,[ObjectPath]
           ,[ObjectReference]
           ,[ObjectType]
           ,[IntegerData]
           ,[ProgressTotal]
           ,[JobID]
           ,[SessionType]
           ,[RequestParameters]
           ,[BinaryData],
		   [ObjectTypeName])
	Values
	(
			@EventClass
           ,@ActivityID
           ,@ApplicationName
           ,@ClientHostName
           ,@ClientProcessID
           ,@ConnectionID
           ,@CurrentTime
           ,@NTDomainName
           ,@NTUserName
           ,@RequestID
           ,@SPID
           ,@ServerName
           ,@StartTime
           ,@CPUTime
           ,@DatabaseName
           ,@Duration
           ,@NTCanonicalUserName
           ,@RequestProperties
           ,@TextData
           ,@Error
           ,@EventSubclass
           ,@SessionID
           ,@Severity
           ,@Success
           ,@EndTime
           ,@ObjectID
           ,@ObjectName
           ,@ObjectPath
           ,@ObjectReference
           ,@ObjectType
           ,@IntegerData
           ,@ProgressTotal
           ,@JobID
           ,@SessionType
           ,@RequestParameters
           ,@BinaryData
		   ,@ObjectTypeName
	)

END
